package com.guigu.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.LbtService;
import com.guigu.vo.Lbt;
import com.guigu.vo.LbtVo;
import com.guigu.vo.Pojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@Controller
@RequestMapping("Lbt")
public class LbtController {
    @Autowired
    private LbtService lbtService;

    @RequestMapping("All/{pageNo}/{pageSize}")
    @ResponseBody
    private Pojo<Lbt> Page1( LbtVo vo, @PathVariable int pageNo, @PathVariable int pageSize){
        PageInfo<Lbt> lbtPageInfo = lbtService.selectAll(vo, pageNo, pageSize);
        Pojo<Lbt> objectPojo = new Pojo<>();
       objectPojo.setRows(lbtPageInfo.getList());
       objectPojo.setTotal(lbtPageInfo.getTotal());
       return objectPojo;
    }
    @PostMapping("One1/{id}")
    @ResponseBody
    private List<Lbt> One1(@PathVariable int id){
        return lbtService.One1(id);
    }
    @PostMapping("One2/{id}")
    @ResponseBody
    private List<Lbt> One2(@PathVariable int id){
        return lbtService.One2(id);
    }
}
